package jsu.ask.service;

import jsu.ask.dao.UserMapper;
import jsu.ask.pojo.User;

import java.util.List;

public class UserServiceImpl implements UserService{

    //service调用dao层：组合Dao
    private UserMapper userMapper;

    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    public int addUser(User user) {
        return userMapper.addUser(user);
    }

    public int deleteUserById(int uid) {
        return userMapper.deleteUserById(uid);
    }

    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }

    public User queryUserById(int uid) {
        return userMapper.queryUserById(uid);
    }

    public List<User> queryAllUser() {
        return userMapper.queryAllUser();
    }

    public User queryUser(String username,String userpassword){ return userMapper.queryUser(username,userpassword);}

    @Override
    public User queryUserByName(String username) {
        return userMapper.queryUserByName(username);
    }
}
